#include <iostream>
#include <vector>

using namespace std;

void merge(vector<int>& nums1, int m, vector<int>& nums2, int n) {
    int p1 = 0;
    int p2 = 0;
    int s[m + n];
    int i = 0;
    while (p1 < m && p2 < n) {
        if (nums1[p1] <= nums2[p2]) {
            s[i++] = nums1[p1++];
        } else {
            s[i++] = nums2[p2++];
        }
    }

    if (p1 == m) {
        while (p2 < n) {
            s[i++] = nums2[p2++];
        }
    } else {
        while (p1 < m) {
            s[i++] = nums1[p1++];
        }
    }
    for (int j = 0; j < m + n; j++) {
        nums1[j] = s[j];
    }
}

int main() {
    cout << "helo world" << endl;
    vector<int> nums1{1, 2, 3, 0, 0, 0};
    vector<int> nums2{2, 5, 6};
    merge(nums1, 3, nums2, 3);

}